package ua.org.plast.mobileApp.navigation;

import ua.org.plast.mobileApp.fragments.BaseFragment;

/**
 * Created with IntelliJ IDEA.
 * User: Virus1908
 * Date: 30.09.13
 * Time: 21:00
 */
public class NavigationItem {
    public final int icon;
    public final String title;
    public final int rightIcon;
    public final Class<? extends BaseFragment> launch;
    public final SubItem[] subItems;
    public boolean isOpen;

    public NavigationItem(int icon, String title, int rightIcon, Class<? extends BaseFragment> launch) {
        this.icon = icon;
        this.title = title;
        this.rightIcon = rightIcon;
        this.launch = launch;
        this.subItems = null;
        isOpen = false;
    }

    public NavigationItem(int icon, String title, Class<? extends BaseFragment> launch) {
        this.icon = icon;
        this.title = title;
        this.rightIcon = -1;
        this.launch = launch;
        this.subItems = null;
        isOpen = false;
    }

    public NavigationItem(int icon, String title, Class<? extends BaseFragment> launch, SubItem[] subItems) {
        this.icon = icon;
        this.title = title;
        this.rightIcon = -1;
        this.launch = launch;
        this.subItems = subItems;
        isOpen = false;
    }

    public boolean hasRightIcon(){
        return rightIcon > 0;
    }

    public boolean hasSubItems(){
        return subItems != null;
    }

    public static class SubItem{
        public final String title;
        public final Class<? extends BaseFragment> launch;

        public SubItem(String title, Class<? extends BaseFragment> launch) {
            this.title = title;
            this.launch = launch;
        }
    }
}
